//将字符串转换为对应的数字
#include "stdio.h"

int main(int argc, char const *argv[])
{
  int strToInt(char string[]);

  printf("%i\n", strToInt("24"));
  printf("%i\n", strToInt("100") + 25);
  printf("%i\n", strToInt("13x5"));

  return 0;
}

int strToInt(char string[])
{
  int i, intValue, result = 0;
  for (i = 0; string[i] >= '0' && string[i] <= '9'; i++)
  {
    intValue = string[i] - '0';
    result = result * 10 + intValue;
  }
  return result;
}
